package org.nokatag.tagjava;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;

import org.nokatag.system.BugInfoWrint;

public class Hidden extends Inputsuper{
	private static final long serialVersionUID = -3668607896986559544L;
	public int doStartTag()throws JspException{
		JspWriter jspOut = pageContext.getOut();
		FormHtmlInsertid(getId(),getName(),getValue());
		HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append(potjs(request));
		stringBuilder.append(hiddenJs(request));
		stringBuilder.append("<input type=\"hidden\" ");
		stringBuilder.append(getBaseStr()+"/>");
		stringBuilder.append("<script type=\"text/javascript\">");
		stringBuilder.append("Event.observe(document, 'dom:loaded', function() {");
		stringBuilder.append("var hiden"+getId()+" = {id:'"+getId()+"'};");
		stringBuilder.append("var hidenobj"+getId()+" = new nkhidden(hiden"+getId()+");");
		stringBuilder.append("hidenobj"+getId()+".show();");
		stringBuilder.append("});");
		stringBuilder.append("</script>");
		try {
			jspOut.write(stringBuilder.toString());
		} catch (IOException e) {
			BugInfoWrint.Print(e);
		}
		return EVAL_BODY_INCLUDE;
	}
}
